<?php

$html = '<div class="userProfile"><h2>Вход</h2></div>';
$html .= '<div class="login">
    <div class="loginInside">
        <form method="POST" action="index.php?p=login">
            <div class="userPass">
                <div>
                    Потребителско име:
                    <br/>
                    <input type="text" name ="username">
                </div>
                <div>
                    Парола:
                    <br/>
                    <input type="password" name="password">
                </div>
            </div>
            <div>
                <input type="submit" value="Вход">
                <a href="index.php?p=register">Регистрация</a>
            </div>
        </form>
    </div>
</div>';

if (count($data['errors']) > 0) {
    foreach ($data['errors'] as $error) {
        $html .= '<p class="error">' . $error . '</p>';
    }
}

echo $html;